package com.zzj.ziputil;

import android.text.TextUtils;
import android.util.Log;
import java.io.File;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/* loaded from: classes2.dex */
public class ArchiverManager extends BaseArchiver {
    private static volatile ArchiverManager mInstance;
    private BaseArchiver mCurrentArchiver;
    private Executor mThreadPool = Executors.newSingleThreadExecutor();

    /* loaded from: classes2.dex */
    public static class ArchiverType {
        public static final String _7Z = "7z";
        public static final String _RAR = "rar";
        public static final String _ZIP = "zip";
    }

    @Override // com.zzj.ziputil.BaseArchiver
    public void doArchiver(File[] fileArr, String str) {
    }

    public static ArchiverManager getInstance() {
        if (mInstance == null) {
            synchronized (ArchiverManager.class) {
                mInstance = new ArchiverManager();
            }
        }
        return mInstance;
    }

    protected ArchiverManager() {
    }

    @Override // com.zzj.ziputil.BaseArchiver
    public synchronized void doUnArchiver(final String str, final String str2, final String str3, final IArchiverListener iArchiverListener) {
        this.mCurrentArchiver = getCorrectArchiver(getFileType(str));
        this.mThreadPool.execute(new Runnable() { // from class: com.zzj.ziputil.ArchiverManager.1
            @Override // java.lang.Runnable
            public void run() {
                ArchiverManager.this.mCurrentArchiver.doUnArchiver(str, str2, str3, iArchiverListener);
            }
        });
    }

    private String getFileType(String str) {
        String str2 = this.TAG;
        Log.i(str2, "getFileType: " + str);
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        String[] split = str.split("\\.");
        return split[split.length - 1];
    }

    private BaseArchiver getCorrectArchiver(String str) {
        char c;
        int hashCode = str.hashCode();
        if (hashCode != 112675) {
            if (hashCode == 120609 && str.equals(ArchiverType._ZIP)) {
                c = 0;
            }
            c = 65535;
        } else {
            if (str.equals(ArchiverType._RAR)) {
                c = 1;
            }
            c = 65535;
        }
        if (c != 0) {
            if (c != 1) {
                return null;
            }
            return new RarArchiver();
        }
        return new ZipArchiver();
    }
}
